home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / FileTransfers.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-31  |  15.3 KB  |  416 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        FileTransfers.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __FILETRANSFERS__
  13. #define __FILETRANSFERS__
  14.  
  15. #ifndef __PACKAGES__
  16. #include <Packages.h>
  17. /*    #include <Types.h>                                            */
  18. /*        #include <ConditionalMacros.h>                            */
  19. /*        #include <MixedMode.h>                                    */
  20. /*            #include <Traps.h>                                    */
  21. #endif
  22.  
  23. #ifndef __CTBUTILITIES__
  24. #include <CTBUtilities.h>
  25. /*    #include <Memory.h>                                            */
  26. /*    #include <StandardFile.h>                                    */
  27. /*        #include <Dialogs.h>                                    */
  28. /*            #include <Windows.h>                                */
  29. /*                #include <Quickdraw.h>                            */
  30. /*                    #include <QuickdrawText.h>                    */
  31. /*                        #include <IntlResources.h>                */
  32. /*                #include <Events.h>                                */
  33. /*                    #include <OSUtils.h>                        */
  34. /*                #include <Controls.h>                            */
  35. /*                    #include <Menus.h>                            */
  36. /*            #include <TextEdit.h>                                */
  37. /*        #include <Files.h>                                        */
  38. /*            #include <SegLoad.h>                                */
  39. /*    #include <AppleTalk.h>                                        */
  40. #endif
  41.  
  42. #ifndef __CONNECTIONS__
  43. #include <Connections.h>
  44. #endif
  45.  
  46. #ifndef __FILES__
  47. #endif
  48.  
  49. #ifndef __TERMINALS__
  50. #include <Terminals.h>
  51. #endif
  52.  
  53. enum  {
  54. /* current file transfer manager version    */
  55.     curFTVersion                = 2,
  56. /* FTErr    */
  57.     ftGenericError                = -1,
  58.     ftNoErr                        = 0,
  59.     ftRejected                    = 1,
  60.     ftFailed                    = 2,
  61.     ftTimeOut                    = 3,
  62.     ftTooManyRetry                = 4,
  63.     ftNotEnoughDSpace            = 5,
  64.     ftRemoteCancel                = 6,
  65.     ftWrongFormat                = 7,
  66.     ftNoTools                    = 8,
  67.     ftUserCancel                = 9,
  68.     ftNotSupported                = 10
  69. };
  70.  
  71. typedef OSErr FTErr;
  72.  
  73. enum  {
  74.     ftIsFTMode                    = 1 << 0,
  75.     ftNoMenus                    = 1 << 1,
  76.     ftQuiet                        = 1 << 2,
  77.     ftConfigChanged                = 1 << 4,
  78.     ftSucc                        = 1 << 7
  79. };
  80.  
  81. typedef unsigned long FTFlags;
  82.  
  83. enum  {
  84.     ftSameCircuit                = 1 << 0,
  85.     ftSendDisable                = 1 << 1,
  86.     ftReceiveDisable            = 1 << 2,
  87.     ftTextOnly                    = 1 << 3,
  88.     ftNoStdFile                    = 1 << 4,
  89.     ftMultipleFileSend            = 1 << 5
  90. };
  91.  
  92. typedef unsigned short FTAttributes;
  93.  
  94. enum  {
  95.     ftReceiving,
  96.     ftTransmitting
  97. };
  98.  
  99. typedef unsigned short FTDirection;
  100.  
  101. typedef pascal long (*FileTransferDefProcPtr)(TermHandle hTerm, short msg, long p1, long p2, long p3);
  102.  
  103. enum {
  104.     uppFileTransferDefProcInfo = kPascalStackBased
  105.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  106.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(TermHandle)))
  107.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  108.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  109.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(long)))
  110.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(long)))
  111. };
  112.  
  113. #if USESROUTINEDESCRIPTORS
  114. typedef UniversalProcPtr FileTransferDefUPP;
  115.  
  116. #define CallFileTransferDefProc(userRoutine, hTerm, msg, p1, p2, p3)        \
  117.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferDefProcInfo, (hTerm), (msg), (p1), (p2), (p3))
  118. #define NewFileTransferDefProc(userRoutine)        \
  119.         (FileTransferDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferDefProcInfo, GetCurrentISA())
  120. #else
  121. typedef FileTransferDefProcPtr FileTransferDefUPP;
  122.  
  123. #define CallFileTransferDefProc(userRoutine, hTerm, msg, p1, p2, p3)        \
  124.         (*(userRoutine))((hTerm), (msg), (p1), (p2), (p3))
  125. #define NewFileTransferDefProc(userRoutine)        \
  126.         (FileTransferDefUPP)(userRoutine)
  127. #endif
  128.  
  129.  
  130. /*    application routines type definitions */
  131.  
  132. typedef struct FTRecord FTRecord, *FTPtr, **FTHandle;
  133.  
  134. typedef pascal OSErr (*FileTransferReadProcPtr)(unsigned long *count, Ptr pData, long refCon, short fileMsg);
  135.  
  136. enum {
  137.     uppFileTransferReadProcInfo = kPascalStackBased
  138.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  139.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned long*)))
  140.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  141.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  142.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  143. };
  144.  
  145. #if USESROUTINEDESCRIPTORS
  146. typedef UniversalProcPtr FileTransferReadUPP;
  147.  
  148. #define CallFileTransferReadProc(userRoutine, count, pData, refCon, fileMsg)        \
  149.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferReadProcInfo, (count), (pData), (refCon), (fileMsg))
  150. #define NewFileTransferReadProc(userRoutine)        \
  151.         (FileTransferReadUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferReadProcInfo, GetCurrentISA())
  152. #else
  153. typedef FileTransferReadProcPtr FileTransferReadUPP;
  154.  
  155. #define CallFileTransferReadProc(userRoutine, count, pData, refCon, fileMsg)        \
  156.         (*(userRoutine))((count), (pData), (refCon), (fileMsg))
  157. #define NewFileTransferReadProc(userRoutine)        \
  158.         (FileTransferReadUPP)(userRoutine)
  159. #endif
  160.  
  161. typedef pascal OSErr (*FileTransferWriteProcPtr)(unsigned long *count, Ptr pData, long refCon, short fileMsg);
  162.  
  163. enum {
  164.     uppFileTransferWriteProcInfo = kPascalStackBased
  165.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  166.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(unsigned long*)))
  167.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(Ptr)))
  168.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  169.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  170. };
  171.  
  172. #if USESROUTINEDESCRIPTORS
  173. typedef UniversalProcPtr FileTransferWriteUPP;
  174.  
  175. #define CallFileTransferWriteProc(userRoutine, count, pData, refCon, fileMsg)        \
  176.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferWriteProcInfo, (count), (pData), (refCon), (fileMsg))
  177. #define NewFileTransferWriteProc(userRoutine)        \
  178.         (FileTransferWriteUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferWriteProcInfo, GetCurrentISA())
  179. #else
  180. typedef FileTransferWriteProcPtr FileTransferWriteUPP;
  181.  
  182. #define CallFileTransferWriteProc(userRoutine, count, pData, refCon, fileMsg)        \
  183.         (*(userRoutine))((count), (pData), (refCon), (fileMsg))
  184. #define NewFileTransferWriteProc(userRoutine)        \
  185.         (FileTransferWriteUPP)(userRoutine)
  186. #endif
  187.  
  188. typedef pascal Size (*FileTransferSendProcPtr)(Ptr thePtr, long theSize, long refCon, CMChannel channel, CMFlags flag);
  189.  
  190. enum {
  191.     uppFileTransferSendProcInfo = kPascalStackBased
  192.          | RESULT_SIZE(SIZE_CODE(sizeof(Size)))
  193.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  194.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  195.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  196.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(CMChannel)))
  197.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(CMFlags)))
  198. };
  199.  
  200. #if USESROUTINEDESCRIPTORS
  201. typedef UniversalProcPtr FileTransferSendUPP;
  202.  
  203. #define CallFileTransferSendProc(userRoutine, thePtr, theSize, refCon, channel, flag)        \
  204.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferSendProcInfo, (thePtr), (theSize), (refCon), (channel), (flag))
  205. #define NewFileTransferSendProc(userRoutine)        \
  206.         (FileTransferSendUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferSendProcInfo, GetCurrentISA())
  207. #else
  208. typedef FileTransferSendProcPtr FileTransferSendUPP;
  209.  
  210. #define CallFileTransferSendProc(userRoutine, thePtr, theSize, refCon, channel, flag)        \
  211.         (*(userRoutine))((thePtr), (theSize), (refCon), (channel), (flag))
  212. #define NewFileTransferSendProc(userRoutine)        \
  213.         (FileTransferSendUPP)(userRoutine)
  214. #endif
  215.  
  216. typedef pascal Size (*FileTransferReceiveProcPtr)(Ptr thePtr, long theSize, long refCon, CMChannel channel, CMFlags *flag);
  217.  
  218. enum {
  219.     uppFileTransferReceiveProcInfo = kPascalStackBased
  220.          | RESULT_SIZE(SIZE_CODE(sizeof(Size)))
  221.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(Ptr)))
  222.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(long)))
  223.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(long)))
  224.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(CMChannel)))
  225.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(CMFlags*)))
  226. };
  227.  
  228. #if USESROUTINEDESCRIPTORS
  229. typedef UniversalProcPtr FileTransferReceiveUPP;
  230.  
  231. #define CallFileTransferReceiveProc(userRoutine, thePtr, theSize, refCon, channel, flag)        \
  232.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferReceiveProcInfo, (thePtr), (theSize), (refCon), (channel), (flag))
  233. #define NewFileTransferReceiveProc(userRoutine)        \
  234.         (FileTransferReceiveUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferReceiveProcInfo, GetCurrentISA())
  235. #else
  236. typedef FileTransferReceiveProcPtr FileTransferReceiveUPP;
  237.  
  238. #define CallFileTransferReceiveProc(userRoutine, thePtr, theSize, refCon, channel, flag)        \
  239.         (*(userRoutine))((thePtr), (theSize), (refCon), (channel), (flag))
  240. #define NewFileTransferReceiveProc(userRoutine)        \
  241.         (FileTransferReceiveUPP)(userRoutine)
  242. #endif
  243.  
  244. typedef pascal OSErr (*FileTransferEnvironsProcPtr)(long refCon, ConnEnvironRec *theEnvirons);
  245.  
  246. enum {
  247.     uppFileTransferEnvironsProcInfo = kPascalStackBased
  248.          | RESULT_SIZE(SIZE_CODE(sizeof(OSErr)))
  249.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(long)))
  250.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(ConnEnvironRec*)))
  251. };
  252.  
  253. #if USESROUTINEDESCRIPTORS
  254. typedef UniversalProcPtr FileTransferEnvironsUPP;
  255.  
  256. #define CallFileTransferEnvironsProc(userRoutine, refCon, theEnvirons)        \
  257.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferEnvironsProcInfo, (refCon), (theEnvirons))
  258. #define NewFileTransferEnvironsProc(userRoutine)        \
  259.         (FileTransferEnvironsUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferEnvironsProcInfo, GetCurrentISA())
  260. #else
  261. typedef FileTransferEnvironsProcPtr FileTransferEnvironsUPP;
  262.  
  263. #define CallFileTransferEnvironsProc(userRoutine, refCon, theEnvirons)        \
  264.         (*(userRoutine))((refCon), (theEnvirons))
  265. #define NewFileTransferEnvironsProc(userRoutine)        \
  266.         (FileTransferEnvironsUPP)(userRoutine)
  267. #endif
  268.  
  269. typedef pascal void (*FileTransferNotificationProcPtr)(FTHandle hFT, FSSpecPtr pFSSpec);
  270.  
  271. enum {
  272.     uppFileTransferNotificationProcInfo = kPascalStackBased
  273.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FTHandle)))
  274.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FSSpecPtr)))
  275. };
  276.  
  277. #if USESROUTINEDESCRIPTORS
  278. typedef UniversalProcPtr FileTransferNotificationUPP;
  279.  
  280. #define CallFileTransferNotificationProc(userRoutine, hFT, pFSSpec)        \
  281.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferNotificationProcInfo, (hFT), (pFSSpec))
  282. #define NewFileTransferNotificationProc(userRoutine)        \
  283.         (FileTransferNotificationUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferNotificationProcInfo, GetCurrentISA())
  284. #else
  285. typedef FileTransferNotificationProcPtr FileTransferNotificationUPP;
  286.  
  287. #define CallFileTransferNotificationProc(userRoutine, hFT, pFSSpec)        \
  288.         (*(userRoutine))((hFT), (pFSSpec))
  289. #define NewFileTransferNotificationProc(userRoutine)        \
  290.         (FileTransferNotificationUPP)(userRoutine)
  291. #endif
  292.  
  293. typedef pascal void (*FileTransferChooseIdleProcPtr)(void);
  294.  
  295. enum {
  296.     uppFileTransferChooseIdleProcInfo = kPascalStackBased
  297. };
  298.  
  299. #if USESROUTINEDESCRIPTORS
  300. typedef UniversalProcPtr FileTransferChooseIdleUPP;
  301.  
  302. #define CallFileTransferChooseIdleProc(userRoutine)        \
  303.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppFileTransferChooseIdleProcInfo)
  304. #define NewFileTransferChooseIdleProc(userRoutine)        \
  305.         (FileTransferChooseIdleUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFileTransferChooseIdleProcInfo, GetCurrentISA())
  306. #else
  307. typedef FileTransferChooseIdleProcPtr FileTransferChooseIdleUPP;
  308.  
  309. #define CallFileTransferChooseIdleProc(userRoutine)        \
  310.         (*(userRoutine))()
  311. #define NewFileTransferChooseIdleProc(userRoutine)        \
  312.         (FileTransferChooseIdleUPP)(userRoutine)
  313. #endif
  314.  
  315. #if defined(powerc) || defined (__powerc)
  316. #pragma options align=mac68k
  317. #endif
  318. struct FTRecord {
  319.     short                        procID;
  320.     FTFlags                        flags;
  321.     FTErr                        errCode;
  322.     long                        refCon;
  323.     long                        userData;
  324.     FileTransferDefUPP            defProc;
  325.     Ptr                            config;
  326.     Ptr                            oldConfig;
  327.     FileTransferEnvironsUPP        environsProc;
  328.     long                        reserved1;
  329.     long                        reserved2;
  330.     Ptr                            ftPrivate;
  331.     FileTransferSendUPP            sendProc;
  332.     FileTransferReceiveUPP        recvProc;
  333.     FileTransferWriteUPP        writeProc;
  334.     FileTransferReadUPP            readProc;
  335.     WindowPtr                    owner;
  336.     FTDirection                    direction;
  337.     SFReply                        theReply;
  338.     long                        writePtr;
  339.     long                        readPtr;
  340.     char                        *theBuf;
  341.     long                        bufSize;
  342.     Str255                        autoRec;
  343.     FTAttributes                attributes;
  344. };
  345. #if defined(powerc) || defined(__powerc)
  346. #pragma options align=reset
  347. #endif
  348.  
  349. enum  {
  350. /* FTReadProc messages */
  351.     ftReadOpenFile                = 0,                            /* count = forkFlags, buffer = pblock from PBGetFInfo */
  352.     ftReadDataFork                = 1,
  353.     ftReadRsrcFork                = 2,
  354.     ftReadAbort                    = 3,
  355.     ftReadComplete                = 4,
  356.     ftReadSetFPos                = 6,                            /* count = forkFlags, buffer = pBlock same as PBSetFPos */
  357.     ftReadGetFPos                = 7,                            /* count = forkFlags, buffer = pBlock same as PBGetFPos */
  358. /* FTWriteProc messages */
  359.     ftWriteOpenFile                = 0,                            /* count = forkFlags, buffer = pblock from PBGetFInfo */
  360.     ftWriteDataFork                = 1,
  361.     ftWriteRsrcFork                = 2,
  362.     ftWriteAbort                = 3,
  363.     ftWriteComplete                = 4,
  364.     ftWriteFileInfo                = 5,
  365.     ftWriteSetFPos                = 6,                            /* count = forkFlags, buffer = pBlock same as PBSetFPos */
  366.     ftWriteGetFPos                = 7,                            /* count = forkFlags, buffer = pBlock same as PBGetFPos */
  367. /*    fork flags */
  368.     ftOpenDataFork                = 1,
  369.     ftOpenRsrcFork                = 2
  370. };
  371.  
  372. #ifdef __cplusplus
  373. extern "C" {
  374. #endif
  375.  
  376. extern pascal FTErr InitFT(void);
  377. extern pascal Handle FTGetVersion(FTHandle hFT);
  378. extern pascal short FTGetFTVersion(void);
  379. extern pascal FTHandle FTNew(short procID, FTFlags flags, FileTransferSendUPP sendProc, FileTransferReceiveUPP recvProc, FileTransferReadUPP readProc, FileTransferWriteUPP writeProc, FileTransferEnvironsUPP environsProc, WindowPtr owner, long refCon, long userData);
  380. extern pascal void FTDispose(FTHandle hFT);
  381. extern pascal FTErr FTStart(FTHandle hFT, FTDirection direction, const SFReply *fileInfo);
  382. extern pascal FTErr FTAbort(FTHandle hFT);
  383. extern pascal FTErr FTSend(FTHandle hFT, short numFiles, FSSpecArrayPtr pFSSpec, FileTransferNotificationUPP notifyProc);
  384. extern pascal FTErr FTReceive(FTHandle hFT, FSSpecPtr pFSSpec, FileTransferNotificationUPP notifyProc);
  385. extern pascal void FTExec(FTHandle hFT);
  386. extern pascal void FTActivate(FTHandle hFT, Boolean activate);
  387. extern pascal void FTResume(FTHandle hFT, Boolean resume);
  388. extern pascal Boolean FTMenu(FTHandle hFT, short menuID, short item);
  389. extern pascal short FTChoose(FTHandle *hFT, Point where, FileTransferChooseIdleUPP idleProc);
  390. extern pascal void FTEvent(FTHandle hFT, const EventRecord *theEvent);
  391. extern pascal Boolean FTValidate(FTHandle hFT);
  392. extern pascal void FTDefault(Ptr *theConfig, short procID, Boolean allocate);
  393. extern pascal Handle FTSetupPreflight(short procID, long *magicCookie);
  394. extern pascal void FTSetupSetup(short procID, const void *theConfig, short count, DialogPtr theDialog, long *magicCookie);
  395. extern pascal Boolean FTSetupFilter(short procID, const void *theConfig, short count, DialogPtr theDialog, EventRecord *theEvent, short *theItem, long *magicCookie);
  396. extern pascal void FTSetupItem(short procID, const void *theConfig, short count, DialogPtr theDialog, short *theItem, long *magicCookie);
  397. extern pascal void FTSetupXCleanup(short procID, const void *theConfig, short count, DialogPtr theDialog, Boolean OKed, long *magicCookie);
  398. extern pascal void FTSetupPostflight(short procID);
  399. extern pascal Ptr FTGetConfig(FTHandle hFT);
  400. extern pascal short FTSetConfig(FTHandle hFT, const void *thePtr);
  401. extern pascal OSErr FTIntlToEnglish(FTHandle hFT, const void *inputPtr, Ptr *outputPtr, short language);
  402. extern pascal OSErr FTEnglishToIntl(FTHandle hFT, const void *inputPtr, Ptr *outputPtr, short language);
  403. extern pascal void FTGetToolName(short procID, Str255 name);
  404. extern pascal short FTGetProcID(ConstStr255Param name);
  405. extern pascal void FTSetRefCon(FTHandle hFT, long refCon);
  406. extern pascal long FTGetRefCon(FTHandle hFT);
  407. extern pascal void FTSetUserData(FTHandle hFT, long userData);
  408. extern pascal long FTGetUserData(FTHandle hFT);
  409. extern pascal void FTGetErrorString(FTHandle hFT, short id, Str255 errMsg);
  410. #ifdef __cplusplus
  411. }
  412. #endif
  413.  
  414. #endif
  415.  
  416.